package sws.alex.run;

import android.graphics.Bitmap;
import android.graphics.Canvas;

@SuppressWarnings("unused")
public class Bullet extends Sprite {
	private int screenWidth, screenHeight;
	private int frameWidth, frameHeight;
	private boolean isAlive;
	
	public Bullet(Bitmap bitmap, int frameWidth, int frameHeight){
		super(bitmap,frameWidth,frameHeight);
		this.frameWidth = frameWidth;
		this.frameHeight = frameHeight;
		defineReferencePixel(frameWidth/2, frameHeight/2);
	}
	
	public void setScreenSize(int screenWidth, int screenHeight){
		this.screenWidth = screenWidth;
		this.screenHeight = screenHeight;
	}
	
	public void setAlive(boolean isAlive, int x, int y){
		this.isAlive = isAlive;
		setPosition(x,y);
	}
	
	public void setAlive(boolean isAlive){
		this.isAlive = isAlive; 
	}
	
	public boolean getAlive(){
		return this.isAlive;
	}
	
	public void move(){
		if(isAlive) move(0,-3);
		if(getY()<0) isAlive = false;
	}
	
	public void draw(Canvas c){
		if(isAlive) paint(c);
	}
}
